package shujia.day11;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/*
    LinkedHashMap是HashMap的子类：底层数据结构是哈希表【唯一性】和双链表【有序】

 */
public class LinkedHashMapDemo1 {
    public static void main(String[] args) {
        LinkedHashMap<Student3, String> map1 = new LinkedHashMap<>();

        map1.put(new Student3("方直", 18), "打游戏");
        map1.put(new Student3("张成阳", 16), "看动漫");
        map1.put(new Student3("方直", 18), "看电影");
        map1.put(new Student3("黄涛", 17), "看书");
        map1.put(new Student3("康清宇", 14), "看美女");


        Set<Map.Entry<Student3, String>> entries = map1.entrySet();
        for (Map.Entry<Student3, String> entry : entries) {
            Student3 key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key + "-" + value);
        }
    }
}
